﻿//
// LastFMPhotoCrawlerSettingsControl.cs: Manages settings for the
// LastFMPhotoCrawler.
//
// Copyright 2010 Michael Goethe
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using S9PalCommon;

namespace LastFMPhotoCrawler
{
    /// <summary>
    /// Manages settings for the LastFMPhotoCrawler.
    /// </summary>
    public partial class LastFMPhotoCrawlerSettingsControl : UserControl, ISettingsControl
    {
        #region Fields

        private String displayTitle = "Last.fm Photo Crawler";

        #endregion

        #region Constructors

        public LastFMPhotoCrawlerSettingsControl()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the display title.
        /// </summary>
        public String DisplayTitle
        {
            get
            {
                return displayTitle;
            }
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// Update form control values.
        /// </summary>
        public void UpdateControlValues()
        {
            httpSleepTimeUpDown.Value = Global.Settings.HTTPSleepTime;
            jpegConversionQualityUpDown.Value = Global.Settings.JPEGConversionQuality;
            maxPhotosPerArtistUpDown.Value = Global.Settings.MaxPhotosPerArtist;
            photosToDownloadPerPassUpDown.Value = Global.Settings.PhotosToDownloadPerPass;
        }

        /// <summary>
        /// Update settings values.
        /// </summary>
        public void ApplySettings()
        {
            Global.Settings.HTTPSleepTime = (int)httpSleepTimeUpDown.Value;
            Global.Settings.JPEGConversionQuality = (int)jpegConversionQualityUpDown.Value;
            Global.Settings.MaxPhotosPerArtist = (int)maxPhotosPerArtistUpDown.Value;
            Global.Settings.PhotosToDownloadPerPass = (int)photosToDownloadPerPassUpDown.Value;
        }

        #endregion
    }
}
